
# exchange数据切换
def  exchange():
     a = [1,2,3,4,5]
     b = []
     for i in a:
         q =i * 10
         b.append(q)
     print(b)

#export
def exportlist():
    a = [1, 2, 3, 4, 5]
    sec = [each_t * 60 for each_t in a]
    print(sec)
def updatebycut():
    a = [1,2,3,4,5,6,7,8,9,10]
    a[::2] = [0,0,0,0,0]
    print(a)
#
def indexlist():
    list = ["zhangsan","lisi","wangwu","zhouliu"]
    index = list.index("zhangsan")
    print(index)
def countdemo():
    list = [1,1,2,3,4,5,6,7,8,9,1,2,3,4,5,8,6,1,4]
    print(list.count(1))
# reverse逆序
def reversedemo():
    list = ["zhangsan","lisi","wangwu","zhouliu"]
    print(list[::-1])
    list.reverse()
    print(list)
# sort排序
def sortdemo():
    numbers = [12,34,3.14,99,-10]
    numbers.sort(reverse=True)
    print(numbers)
#sortde自动排序
def sorteddemo():
    list = ["1","5","4","3"]
    data = sorted(list)
    print(list)
    print(data)
def demo():
    data = [12.04,11.15,13.47,13.58,12.04,12.04,11.15,12.58,11.15]
    # 1
    num = len(data)
    print(data)
    print(num)
    times = data.count(12.04)
    print(times)

    minx = min(data)
    print(minx)
    data.remove(minx)
    print(data)
#dim2列表
def dim2():
    persons = [["tom",25,1.78],["terry",30,1.80],["lili",22,1.68]]
    for p in persons:
        print(p)
        for i in p:
            print(i)
def dim2spacail():
    persons = [["tom",25,1.78],["terry",30,1.80],["lili",22,1.68]]
    for person in persons:
        print(person)
        print(person[2])
#拷贝--浅拷贝
def copydemo():
    list1 = [1,2,3]
    list2 = list1
    print(list2)
    list2[0] = 100
    print(list1)
def createdic():
    stu = {"zhangli": 58,"lily": 70}
    print(stu)
    for i in stu:
        print(i,stu[i])
#消除
def deldemo():
    stu = {"zhangli": 58,"lily": 70}
    del stu["lily"]
    print(stu)
def getdemo():
    stu = {"zhangli": 58, "lily": 70}

    data = stu["zhangli"]
    print(data)

    data2 = stu.get("zhangli")
    print(data2)
#例题
def dicdemo():
    stu = {"张琳":58,"孙治平":70,"徐小伟":89,"徐丽苹":69,"童万丽":90}
    # 1
    dicdata = {"张琳":"缺考"}
    stu.update(dicdata)
    print(stu)
    # 2
    stu["张琳"] = 60
    print(stu)
    # 3
    del stu["徐小伟"]
    print(stu)
    # 4
    # 5
    print("人数",len(stu))
    # 6
    name = input('请输入名字:')
    if name in stu:
        print('该同学的成绩为:',stu[name])
    else:
        print("没有找到该同学")


if __name__ == '__main__':
    dicdemo()